﻿using DemoWebapi01.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace DemoWebapi01.EntityTypeConfiguration
{
    public class RoleETConfig : BaseEntityETConfig<Role>
    {
        protected override void ConfigureOtherProperties(EntityTypeBuilder<Role> builder)
        {
            builder.Property(e => e.RoleName).HasMaxLength(200).IsRequired().HasComment("角色名");
            builder.Property(e => e.Description).HasMaxLength(200).HasComment("描述");
            //配置多对多关系
            builder.HasMany(e => e.Users).WithMany(e => e.Roles);
        }
    }
}
